//
//  TSBugDidSelectOnButtonViewController.m
//  CJUIKitDemo
//
//  Created by ciyouzen on 15/11/12.
//  Copyright (c) 2015年 dvlproad. All rights reserved.
//

#import "TSBugDidSelectOnButtonViewController.h"
#import <CQDemoKit/CJUIKitToastUtil.h>
#import <CQDemoKit/CQTSRipeTableView.h>

#import "UIViewController+TSBug.h"

@interface TSBugDidSelectOnButtonViewController () <UITableViewDelegate> {
    
}
@property (nonatomic, strong) UITableView *tableView;

@end

@implementation TSBugDidSelectOnButtonViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = NSLocalizedString(@"测试点击失效问题(添加在Button按钮上)", nil);
    
    
    CQTSRipeTableView *tableView = [[CQTSRipeTableView alloc] initWithSectionRowCounts:@[@3, @4, @5]];
    tableView.delegate = self;
    [self.view addSubview:tableView];
    [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(self.view);
        make.top.mas_equalTo(self.mas_topLayoutGuide).mas_offset(10);
        make.height.mas_equalTo(300);
    }];
    self.tableView = tableView;
    
    UIButton *tapButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [tapButton addTarget:self action:@selector(tapBlankViewAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:tapButton];
    [tapButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.view);
    }];
    [self.view sendSubviewToBack:tapButton];
}


/** 点击空白区域的事件 */
- (void)tapBlankViewAction:(UIButton *)tapButton {
    [CJUIKitToastUtil showMessage:@"注意是否正确：如果点击cell的时候是响应tap的手势事件那就错误了"];
}


#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [CJUIKitToastUtil showMessage:@"正确：点击cell的时候响应cell的点击事件才是正确的"];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
